Biodepth

Dados

Biomassa

BIOMASSA <- read.csv("biodepth/BiodepthSpeciesBiomass.csv", sep = ";", h=T)

Sweden e Sheffield não tem funções de solo medidas & só tem funcoes medidas pra o ano 3 + portugal só sobra 2 amostras quando tira as especies que nao tenho traits = vou filtrar esses

BIOMASSA <- BIOMASSA %>%
  filter(!(site %in% c("Sweden", "Sheffield", "Portugal"))) %>%
  filter(year == 3)

###Biomassa relativa

BIOMASSA <- BIOMASSA %>%
  group_by(year, site, block, plot) %>%
  mutate(percentage_biomass = 100 * biomass / sum(biomass, na.rm = TRUE))

datatable(BIOMASSA, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
ggplot(BIOMASSA, aes(x = biomass)) +
  geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
  labs(title = "Biomassa Biodepth", 
       x = "Biomassa", 
       y = "Frequência") +
  theme_minimal()

ggplot(BIOMASSA, aes(x = percentage_biomass)) +
  geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
  labs(title = "Biomassa relativa Biodepth", 
       x = "Biomassa relativa", 
       y = "Frequência") +
  theme_minimal()

Passando de biomassa para composição de espécies

COMPOSICAO <- BIOMASSA %>% 
  group_by(year,location,site,block,plot,sr,fr,fgc,mix.nest,mix,grass,forb,legume,funct,GRASS,FORB,LEG) %>% 
  pivot_wider(
    names_from = species,
    values_from = percentage_biomass,
    values_fill = list(percentage_biomass=0))

#matrix de abundancia
abundance <- COMPOSICAO %>%
  ungroup() %>%
  mutate(unique_plot = paste(plot, block, year, site, sep = "_")) %>%
  group_by(unique_plot) %>%
  summarise(across(where(is.numeric), sum, na.rm = TRUE)) %>%
  column_to_rownames(var = "unique_plot") %>% 
  dplyr::select(-year,-location, -sr, -fr,-fgc, -mix.nest, -mix, -biomass)

# Cria a coluna 'riqueza' contando o número de espécies em cada plot
abundance$riqueza <- rowSums(abundance > 0)
abundance_filtrado <- abundance[abundance$riqueza > 3, ]
abundance_filtrado$riqueza <- NULL

#Remover espécies que não aparecem em nenhum plot
abundance_filtrado <- abundance_filtrado[, colSums(abundance_filtrado, na.rm = TRUE) > 0]

abundance_matrix <- as.matrix(abundance_filtrado)

FUNCIONAL

fd <- dbFD(trait_dat, abundance_matrix)
## FRic: Dimensionality reduction was required. The last 51 PCoA axes (out of 54 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.970528
Functional <- data.frame(raoq = fd$RaoQ, FRic = fd$FRic,FEve = fd$FEve, FDis = fd$FDis, FD = fd$nbsp )

datatable(Functional, options= list(deferRender = TRUE,   scroller = TRUE,  scrollX=T, scrollY = "350px", autoWidth=T), rownames=T)
hist(Functional$FRic)

hist(Functional$raoq)

MULTIFUNCIONALIDADE

multi <- cbind(dataset_biodep1, getStdAndMeanFunctions(dataset_biodep1, vars))

Dataset final

dataset_final <- multi %>%
  left_join(Functional, by = c("plot", "site"))

datatable(dataset_final, options= list(deferRender = TRUE,    scroller = TRUE, scrollY = "350px", scrollX=T, autoWidth=T), rownames=T)

Análise

cor_matrix
##            raoq        FRic       FEve      FDis         FD
## raoq 1.00000000  0.08562603  0.3526263 0.9650922  0.1035145
## FRic 0.08562603  1.00000000 -0.2093003 0.1011771  0.8329241
## FEve 0.35262633 -0.20930027  1.0000000 0.4045607 -0.1835774
## FDis 0.96509217  0.10117705  0.4045607 1.0000000  0.1378217
## FD   0.10351450  0.83292415 -0.1835774 0.1378217  1.0000000
ggcorrplot(cor_matrix, 
           method = "circle", 
           type = "lower", 
           lab = TRUE, 
           title = "Índices de Diversidade Funcional")

Mixed model

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|site),data = biodepth[-46,])
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | site)
## Data: biodepth[-46, ]
## 
##      AIC      BIC   logLik deviance df.resid 
##   -216.1   -202.4    113.0   -226.1      108 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance Std.Dev.
##  site     (Intercept) 0.005686 0.07541 
##  Residual             0.006957 0.08341 
## Number of obs: 113, groups:  site, 5
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00696 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  3.656e-01  3.749e-02   9.752  < 2e-16 ***
## raoq        -9.716e-04  5.443e-04  -1.785   0.0742 .  
## FRic         3.082e-04  7.098e-05   4.341 1.42e-05 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal

outliers(mod_resid)
## [1] 40
ggplot(biodepth, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(biodepth, aes(x = raoq, y = meanFunction, color = as.factor(site))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(site)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

Ceedar Creek

e097

Avaliar o efeito de diferentes níveis de fertilização com nitrogênio em um experimento de competição de árvores.

9 TRTAMENTOS de adição de nitrogênio:
1: 0g/m²/ano nitrogênio (com micronutrientes)
2: 3g/m²/ano nitrogênio (com micronutrientes)
3: 6g/m²/ano nitrogênio (com micronutrientes)
4: 10g/m²/ano nitrogênio (com micronutrientes)
5: 16g/m²/ano nitrogênio (com micronutrientes)
6: 28g/m²/ano nitrogênio (com micronutrientes)
7: 50g/m²/ano nitrogênio (com micronutrientes)
8: 80g/m²/ano nitrogênio (com micronutrientes)
9: 0g/m²/ano (sem nitrogênio sem micronitrientes)

Dados

Biomassa

biomassa <- read.table("e097/e097_Plant aboveground biomass data.txt", h=T, sep="\t")

Filtrando o ano 1982 porque as funções foram coletadas aqui.

biomassa <- biomassa %>%  
  filter(year=="1982")

Biomassa relativa

biomassa <- biomassa %>%
  group_by(Field, plot.number) %>%
  mutate(percentage_biomass = 100 * Species.Biomass..g.m2. / sum(Species.Biomass..g.m2., na.rm = TRUE))

datatable(biomassa, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
ggplot(biomassa, aes(x = percentage_biomass)) +
  geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
  labs(title = "Biomassa relativa CEDAR CREEK e97", 
       x = "Biomassa relativa", 
       y = "Frequência") +
  theme_minimal()

###FUNCIONAL

# Cálculo da diversidade funcional
fd <- dbFD(trait_dat, abundance_matrix_clean)
## FRic: Dimensionality reduction was required. The last 60 PCoA axes (out of 64 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9789017
Functional <- data.frame(raoq = fd$RaoQ, FRic = fd$FRic,FEve = fd$FEve, FDis = fd$FDis, FD = fd$nbsp )

datatable(Functional, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)

MULTIFUNCIONALIDADE

#Dataset junto das funções
funcoes <- potassioFunc %>%
  full_join(fosforoFunc, by = c("Plot.number", "Field.letter")) %>%
  full_join(calcioFunc, by = c("Plot.number", "Field.letter")) %>%
  full_join(magnesioFunc, by = c("Plot.number", "Field.letter")) %>%
  full_join(nitroFunc, by = c("Plot.number", "Field.letter")) %>%
  full_join(phFunc, by = c("Plot.number", "Field.letter"))
e97_multifuncionalidade <- cbind(datset_97, getStdAndMeanFunctions(datset_97, vars))

Dataset final

dataset_final_e97 <- e97_multifuncionalidade %>%
  left_join(Functional, by = c("Plot.number", "treatment", "Field.letter"))

datatable(dataset_final_e97, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)

Análise

cor_matrix
##            raoq      FRic       FEve       FDis          FD
## raoq  1.0000000 0.1762663 0.19790931  0.9697383 -0.19715587
## FRic  0.1762663 1.0000000 0.15502712  0.1612947  0.79029689
## FEve  0.1979093 0.1550271 1.00000000  0.3268466  0.04754828
## FDis  0.9697383 0.1612947 0.32684660  1.0000000 -0.18431343
## FD   -0.1971559 0.7902969 0.04754828 -0.1843134  1.00000000
ggcorrplot(cor_matrix, 
           method = "circle", 
           type = "lower", 
           lab = TRUE, 
           title = "Índices de Diversidade Funcional")

Mixed model

mod1 <- glmmTMB(log(meanFunction) ~ raoq + FRic + (1|Field.letter),data = e97)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          log(meanFunction) ~ raoq + FRic + (1 | Field.letter)
## Data: e97
## 
##      AIC      BIC   logLik deviance df.resid 
##   -247.4   -234.0    128.7   -257.4      103 
## 
## Random effects:
## 
## Conditional model:
##  Groups       Name        Variance Std.Dev.
##  Field.letter (Intercept) 0.008875 0.09421 
##  Residual                 0.004963 0.07045 
## Number of obs: 108, groups:  Field.letter, 2
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00496 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -3.713e-01  8.333e-02  -4.456 8.36e-06 ***
## raoq        -1.744e-03  8.262e-04  -2.111   0.0348 *  
## FRic        -6.280e-06  5.547e-05  -0.113   0.9099    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal

outliers(mod_resid)
## [1] 26
ggplot(e97, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(e97, aes(x = raoq, y = meanFunction, color = as.factor(Field.letter))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Field.letter)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

#Tirando outliers
e97_semot <- e97 %>% 
  filter(!raoq <40) %>%   
  filter(!meanFunction >0.9)

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|Field.letter),data = e97_semot)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | Field.letter)
## Data: e97_semot
## 
##      AIC      BIC   logLik deviance df.resid 
##   -365.3   -352.0    187.6   -375.3      101 
## 
## Random effects:
## 
## Conditional model:
##  Groups       Name        Variance Std.Dev.
##  Field.letter (Intercept) 0.002786 0.05278 
##  Residual                 0.001558 0.03947 
## Number of obs: 106, groups:  Field.letter, 2
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00156 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  6.475e-01  4.952e-02  13.076   <2e-16 ***
## raoq        -5.073e-04  5.304e-04  -0.956    0.339    
## FRic         1.815e-05  3.150e-05   0.576    0.564    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(e97_semot, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(e97_semot, aes(x = raoq, y = meanFunction, color = as.factor(Field.letter))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Field.letter)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

ggplot(e97_semot, aes(x = FRic, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'

e120

Biodiversity II, effects od plant biodiversity on population and ecossystem process

  • Determinar como a quantidade de espécies de plantas afeta processos ecológicos nos níveis populacional, de comunidade e ecossistêmico. Como a diversidade de plantas influencia a produção de biomassa, a estabilidade do ecossistema, a incidência de doenças, a diversidade de insetos herbívoros e predadores, e outros parâmetros do solo.

168 parcelas de 9m x 9m.

Tratamentos: Parcelas com 1, 2, 4, 8 ou 16 espécies de plantas, com cerca de 30 réplicas para cada nível de diversidade.

COMPOSIÇÃO DAS ESPECIES

datatable(cover, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
# Calcular a cobertura relativa por quadrante dentro de cada plot
cover <- cover %>%
  group_by(Year, Plot, Quadrat) %>%
  mutate(percentage_cover = 100 * Abscover / sum(Abscover, na.rm = TRUE))

# Somar a cobertura por espécie dentro de cada plot e ano
cover <- cover %>%
  group_by(Year, Plot, Species) %>%
  summarize(Total_Abscover = sum(percentage_cover, na.rm = TRUE)) %>%
  ungroup()
## `summarise()` has grouped output by 'Year', 'Plot'. You can override using the
## `.groups` argument.
# Padronizar para que a soma total seja 100% dentro de cada plot
cover <- cover %>%
  group_by(Year, Plot) %>%
  mutate(cover_final = 100 * Total_Abscover / sum(Total_Abscover, na.rm = TRUE)) %>%
  ungroup()

ggplot(cover, aes(x = Total_Abscover)) +
geom_histogram(bins = 50, fill = "blue", color = "black")

ggplot(cover, aes(x = cover_final)) +
  geom_histogram(bins = 50, fill = "blue", color = "black")

FUNCIONAL

fd_120 <- dbFD(trait_dat_120, abundance_120_matrix_clean)
## FEVe: Could not be calculated for communities with <3 functionally singular species. 
## FDis: Equals 0 in communities with only one functionally singular species. 
## FRic: To respect s > t, FRic could not be calculated for communities with <3 functionally singular species. 
## FRic: Dimensionality reduction was required. The last 75 PCoA axes (out of 77 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.9697847 
## FDiv: Could not be calculated for communities with <3 functionally singular species.
Functional_120 <- data.frame(raoq = fd_120$RaoQ, FRic = fd_120$FRic,FEve = fd_120$FEve, FDis = fd_120$FDis, FD = fd_120$nbsp )

hist(Functional_120$raoq)

hist(Functional_120$FRic)

MULTIFUNCIONALIDADE

#quantidades de amostragem tudo diferente nos anos 
#carbon_nitroFunc 1164
#biomassaFunc 1862
#soil_carbonFunc 726
#nitrat_amoniFunc 1194
#soil_nitroFunc 726

data_list <- list(carbon_nitroFunc, biomassaFunc, soil_carbonFunc, nitrat_amoniFunc, soil_nitroFunc)
combined_data <- reduce(data_list, full_join, by = c("Year", "Plot"))

#remover todos os dados ausentes
#so sobra 1996 e 2000
funcoes_120 <- na.omit(combined_data)
e120_multifuncionalidade <- cbind(dataset_120, getStdAndMeanFunctions(dataset_120, vars120))

Dataset COMPLETO

dataset_final_120 <- e120_multifuncionalidade %>%
  left_join(Functional_120, by = c("Plot", "Year")) 

datatable(dataset_final_120, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
#Vou apenas cortar
##Help####
dataset_final_120 <- dataset_final_120 %>% 
  filter(FDis < 10, raoq < 50, FRic < 200)

Análise

cor_matrix
##           raoq       FRic        FEve      FDis         FD
## raoq 1.0000000  0.2782868  0.22545819 0.9205079 0.28265829
## FRic 0.2782868  1.0000000 -0.13035791 0.3107401 0.63200557
## FEve 0.2254582 -0.1303579  1.00000000 0.1708288 0.06211653
## FDis 0.9205079  0.3107401  0.17082879 1.0000000 0.34517506
## FD   0.2826583  0.6320056  0.06211653 0.3451751 1.00000000
ggcorrplot(cor_matrix, 
           method = "circle", 
           type = "lower", 
           lab = TRUE, 
           title = "Índices de Diversidade Funcional")

Mixed model

mod1 <- glmmTMB(log(meanFunction) ~ raoq + FRic + (1|Year),data = e120)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          log(meanFunction) ~ raoq + FRic + (1 | Year)
## Data: e120
## 
##      AIC      BIC   logLik deviance df.resid 
##   -173.4   -154.7     91.7   -183.4      304 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev.
##  Year     (Intercept) 0.0005291 0.0230  
##  Residual             0.0320813 0.1791  
## Number of obs: 309, groups:  Year, 2
## 
## Dispersion estimate for gaussian family (sigma^2): 0.0321 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept) -1.0295926  0.0336842 -30.566  < 2e-16 ***
## raoq         0.0059317  0.0012417   4.777 1.78e-06 ***
## FRic         0.0001530  0.0003451   0.443    0.657    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal

outliers(mod_resid)
## [1]   5  39 166 219 261
ggplot(e120, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(e120, aes(x = raoq, y = meanFunction, color = as.factor(Year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).

#Tirando outliers
e120_semot <- e120 %>% 
  filter(!raoq >100) %>% 
  filter(!FRic >150)

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|Year),data = e120_semot)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | Year)
## Data: e120_semot
## 
##      AIC      BIC   logLik deviance df.resid 
##   -733.3   -714.7    371.7   -743.3      300 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev.
##  Year     (Intercept) 5.007e-05 0.007076
##  Residual             5.088e-03 0.071328
## Number of obs: 305, groups:  Year, 2
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00509 
## 
## Conditional model:
##              Estimate Std. Error z value Pr(>|z|)    
## (Intercept) 0.3620884  0.0133443  27.134  < 2e-16 ***
## raoq        0.0020775  0.0005000   4.155 3.26e-05 ***
## FRic        0.0001019  0.0001495   0.682    0.495    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(e120_semot, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(e120_semot, aes(x = raoq, y = meanFunction, color = as.factor(Year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(e120_semot, aes(x = FRic, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(e120_semot, aes(x = FRic, y = meanFunction, color=as.factor(Year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(Year)), method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 9 rows containing non-finite outside the scale range (`stat_smooth()`).
## Removed 9 rows containing missing values or values outside the scale range
## (`geom_point()`).

Jena dBEF

Tratamento 1 - Sem história de solo e sem história de plantas: O solo e a camada de plantas foram removidos até 30 cm de profundidade e substituídos por solo de um campo arável adjacente. Tratamento 2 - Com história de solo, mas sem história de plantas: A camada de plantas foi removida, mas o solo original foi mantido. Tratamento 3 - Com história de solo e de plantas: As parcelas existentes do experimento principal, estabelecidas desde 2002, foram mantidas como controle de longo prazo, mantendo tanto a história do solo quanto a das plantas. Esses tratamentos foram projetados para testar como a história do solo e das plantas influenciam a produtividade vegetal e as interações ecológicas ao longo do tempo, considerando tanto a diversidade de plantas quanto os efeitos do histórico do solo sobre a biomassa e outros fatores ecológicos.

80 plots 3 tratamentos 3 anos

COMPOSIÇÃO DAS ESPÉCIES: cobertura

cobertura_2017 <- read.csv("dbef/PLANT_COVER_2017.csv", sep = ";")
cobertura_2018 <- read.csv("dbef/PLANT_COVER_2018.csv", sep = ";")
cobertura_2019 <- read.csv("dbef/PLANT_COVER_2019.csv", sep = ";")

cobertura_total <- bind_rows(cobertura_2017, cobertura_2018, cobertura_2019)
datatable(cobertura_total, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)
## Warning in instance$preRenderHook(instance): It seems your data is too big for
## client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html

FUNCIONAL

#diversidade funcional
fd_dbef <- dbFD(trait_dat_dbef, abundance_dbef_matrix_clean)
## FEVe: Could not be calculated for communities with <3 functionally singular species. 
## FDis: Equals 0 in communities with only one functionally singular species. 
## FRic: To respect s > t, FRic could not be calculated for communities with <3 functionally singular species. 
## FRic: Dimensionality reduction was required. The last 57 PCoA axes (out of 59 in total) were removed. 
## FRic: Quality of the reduced-space representation = 0.7574923 
## FDiv: Could not be calculated for communities with <3 functionally singular species.
Functional_dbef <- data.frame(raoq = fd_dbef$RaoQ, FRic = fd_dbef$FRic,FEve = fd_dbef$FEve, FDis = fd_dbef$FDis, FD = fd_dbef$nbsp )

datatable(Functional_dbef, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)

MULTIFUNCIONALIDADE

# Combinar os Dados com a Base
dados_combinados <- base %>%
  left_join(cobertura_media, by = c("plot", "treatment", "year")) %>%
  left_join(biomass_summary, by = c("plot", "treatment", "year")) %>%
  left_join(atv_micro, by = c("plot", "treatment", "year")) %>%
  left_join(herbivoria_total, by = c("plot", "treatment", "year")) %>%
  left_join(predacao, by = c("plot", "treatment", "year"))
dbef_multifunc <- cbind(dados_combinados, getStdAndMeanFunctions(dados_combinados, func_vars))

DATASET COMPLETAO

dataset_final_JENA <- dbef_multifunc %>%
  left_join(Functional_dbef, by = c("plot", "treatment", "year"))

datatable(dataset_final_JENA, options= list(deferRender = TRUE,  scrollY = "350px", scrollX=T,   scroller = TRUE,  autoWidth=T), rownames=T)

Análise

cor_matrix
##           raoq       FRic       FEve      FDis        FD
## raoq 1.0000000 0.55127018 0.33838727 0.9545245 0.4651809
## FRic 0.5512702 1.00000000 0.09063385 0.4986894 0.6718329
## FEve 0.3383873 0.09063385 1.00000000 0.3517603 0.2450418
## FDis 0.9545245 0.49868937 0.35176030 1.0000000 0.4626148
## FD   0.4651809 0.67183287 0.24504183 0.4626148 1.0000000
ggcorrplot(cor_matrix, 
           method = "circle", 
           type = "lower", 
           lab = TRUE, 
           title = "Índices de Diversidade Funcional")

Mixed model

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|year),data = jena)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | year)
## Data: jena
## 
##      AIC      BIC   logLik deviance df.resid 
##  -1285.8  -1266.2    647.9  -1295.8      364 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev.
##  year     (Intercept) 0.0008237 0.02870 
##  Residual             0.0016904 0.04111 
## Number of obs: 369, groups:  year, 3
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00169 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  2.125e-01  1.723e-02  12.334  < 2e-16 ***
## raoq        -2.653e-04  1.732e-04  -1.532 0.125645    
## FRic         1.402e-04  4.223e-05   3.319 0.000903 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
mod_resid <- simulateResiduals(fittedModel = mod1, plot = FALSE)
plot(mod_resid) # resíduos não tá normal

outliers(mod_resid)
## [1] 363
ggplot(jena, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 164 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 164 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena, aes(x = raoq, y = meanFunction, color = as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 164 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 164 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena, aes(x = raoq, y = meanFunction, color = as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 164 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 164 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena, aes(x = FRic, y = meanFunction, color = as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 351 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 351 rows containing missing values or values outside the scale range
## (`geom_point()`).

#Tirando outliers
jena_semot <- jena %>% 
  filter(!raoq >75)

mod1 <- glmmTMB(meanFunction ~ raoq + FRic + (1|year),data = jena_semot)
summary(mod1)
##  Family: gaussian  ( identity )
## Formula:          meanFunction ~ raoq + FRic + (1 | year)
## Data: jena_semot
## 
##      AIC      BIC   logLik deviance df.resid 
##  -1281.6  -1262.0    645.8  -1291.6      363 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev.
##  year     (Intercept) 0.0008164 0.02857 
##  Residual             0.0016935 0.04115 
## Number of obs: 368, groups:  year, 3
## 
## Dispersion estimate for gaussian family (sigma^2): 0.00169 
## 
## Conditional model:
##               Estimate Std. Error z value Pr(>|z|)    
## (Intercept)  2.118e-01  1.720e-02  12.311  < 2e-16 ***
## raoq        -2.293e-04  1.840e-04  -1.247  0.21247    
## FRic         1.375e-04  4.253e-05   3.232  0.00123 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggplot(jena_semot, aes(x = raoq, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 160 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 160 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena_semot, aes(x = raoq, y = meanFunction, color = as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "RAOQ",
       x = "raoq", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 160 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 160 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena_semot, aes(x = FRic, y = meanFunction)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 347 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 347 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(jena_semot, aes(x = FRic, y = meanFunction, color=as.factor(year))) +
  geom_point() +
  geom_smooth(aes(group = as.factor(year)), method = "lm", se = FALSE) +
  labs(title = "FRic",
       x = "FRic", y = "meanFunction") +
  theme_get()
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 347 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Removed 347 rows containing missing values or values outside the scale range
## (`geom_point()`).